// #ifdef APP-PLUS
import { AppSharePopup } from '@/entity/AppSharePopup.class.js';
// #endif
const ShareAppMixin = {
	// #ifdef APP-PLUS
	data() {
		return {
			shareData: {
				share_brief: '',
				share_image: '',
				share_path: '',
				share_title: '',
				share_url: '',
				share_query: ''
			},
			actionList: [],
			appSharePopup: null
		}
	},
	methods: {
		initAppSharePopop(auto = false) {
			let actionList = this.actionList;
			this.appSharePopup = new AppSharePopup({
				shareInfo: this.shareData,
				actionList: this.actionList.map(item => {
					if ((typeof item.onClick) != 'function') {
						item.onClick = this.onClickAppSharePopupAction;
					}
					return item
				})
			});

			if (auto) {
				this.appSharePopup.show()
			}
		},
		onClickAppSharePopupAction(data) {
			this.appSharePopup.hide();
			this.onClickActionItem(data.index, data);
		},
		onClickActionItem(index, data) {

		}
	}
	// #endif

}

export default ShareAppMixin;
